package com.stm.bi.service;

import com.stm.bi.dto.query.DemoChartQuery;
import com.stm.bi.dto.vo.DemoStatisticsVO;
import com.stm.bi.model.Chart;
import com.stm.bi.model.DatatablePage;
import com.stm.bi.model.DatatableQuery;
import com.stm.bi.report.demo.DemoDatatableQueryExe;
import com.stm.bi.report.demo.DemoChartQueryExe;
import com.stm.framework.dto.Response;
import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Service;

import java.io.IOException;

/**
 * @Author chenyingjun
 * @Desc
 * @Date 2025/2/11 10:05
 */
@Service
public class DemoService {

    @Resource
    private DemoChartQueryExe demoChartQueryExe;
    @Resource
    private DemoDatatableQueryExe demoDatatableQueryExe;

    public Response<Chart<DemoStatisticsVO>> queryChart(DemoChartQuery demoChartQuery){
        return demoChartQueryExe.query(demoChartQuery);
    }

    public Response<DatatablePage<DemoStatisticsVO>> queryDatatable(DatatableQuery datatableQuery){
        return demoDatatableQueryExe.query(datatableQuery);
    }

    public void expDatatable(HttpServletResponse servletResponse,DatatableQuery datatableQuery) throws IOException {
        demoDatatableQueryExe.export(servletResponse,datatableQuery);
    }
}
